package com.o2opuzi.lib.util;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;


import com.alibaba.fastjson.JSON;

/**
 * 生成订单号
 * @author yue hanjiang
 */
public class TradeNoUtils {
	
	
	
	private  static String createNo(){
		StringBuilder str = new StringBuilder();
		str.append(DateUtils.format(new Date(), "yyyyMMddHHmmss"+RandomStringUtils.randomNum(3)));
		str.append(RandomStringUtils.randomNum(4));
		return str.toString();
	}
	
	public synchronized static String create(){
		return createNo().toString();
	}
	
	
	
	public static void main(String[] args) {
		Set<String> haSet = new LinkedHashSet<String>();
		for (int i = 0; i < 1000; i++) {
			haSet.add(create());
		}
		System.out.println(haSet.size());
		System.out.println(haSet);
	}
}
